﻿using System.Collections.Generic;
using UnityEditor;
using UnityEngine;

namespace ExcelExpoter.Editor
{
    internal static class ExcelExporterStyle
    {
        private static Dictionary<string, GUIStyle> _cache = new Dictionary<string, GUIStyle>();
        public static Texture2D MainWindowIcon => Resources.Load<Texture2D>("Icons/HA_WindowIconLive");
        public static Vector2 MainWindowMinSize => new Vector2(520, 240);
        
        public static Color Selected = new Color(0.15f, 0.46f, 0.46f, 0.75f);
        public static Color Normal = new Color(0f, 0f, 0f, 0.48f);

        public static GUIStyle Line => "sv_iconselector_sep";
        public static GUIStyle SelectFolder
        {
            get
            {
                var key = "SelectFolder";
                if (!_cache.ContainsKey(key))
                {
                    var newSty = new GUIStyle()
                    {
                        fixedWidth = 18, fixedHeight = 18,
                        normal = new GUIStyleState() {background = (Texture2D) EditorGUIUtility.IconContent("d_Folder Icon").image,},
#if UNITY_2020_1_OR_NEWER
                        hover = new GUIStyleState() {background = (Texture2D) EditorGUIUtility.IconContent("d_FolderOpened Icon").image,}, 
                        #else
                        hover = new GUIStyleState() {background = (Texture2D) EditorGUIUtility.IconContent("d_OpenedFolder Icon").image,}, 
#endif
                    };
                    _cache.Add(key, newSty);
                }
                return _cache[key];
            }
        }
        public static GUIStyle ExcelItemHeader => "PreToolbar";
        public static GUIStyle ExcelItemHeaderToolBarDropDown => "ToolbarPopup";
        public static GUIStyle ExcelItemHeaderToolBarLabel => "ToolbarLabel";
        public static GUIStyle ExcelItemContainer => "IN BigTitle";
        public static GUIStyle ExcelItem => "IN ThumbnailShadow";
        public static GUIStyle PathItem => "ProgressBarBack";
        public static GUIStyle Button => "toolbarbutton";
    }
}